#include "ColladaWriter.h"
#include <iostream>

using namespace std;

ColladaWriter::ColladaWriter( void )
    : scene(NULL)
{
}

ColladaWriter::~ColladaWriter( void )
{
    if (scene != NULL) {
        delete scene;
    }
}


void ColladaWriter::cancel(const COLLADAFW::String& errorMessage)
{
}

void ColladaWriter::start()
{
    this->scene = new ColladaGLScene();
}

void ColladaWriter::finish()
{
}

bool ColladaWriter::writeGlobalAsset( const COLLADAFW::FileInfo* asset )
{
    return true;
}

bool ColladaWriter::writeScene( const COLLADAFW::Scene* scene )
{
    return true;
}

bool ColladaWriter::writeVisualScene( const COLLADAFW::VisualScene* scene )
{
    return true;
}

bool ColladaWriter::writeLibraryNodes( const COLLADAFW::LibraryNodes* libraryNodes )
{
    return true;
}

bool ColladaWriter::writeGeometry( const COLLADAFW::Geometry* geometry )
{
    if ( geometry->getType() != COLLADAFW::Geometry::GEO_TYPE_MESH ) {
        return true;
    }

    const COLLADAFW::Mesh* mesh = dynamic_cast<const COLLADAFW::Mesh*>(geometry);

    const COLLADAFW::MeshVertexData& positions = mesh->getPositions();
    const COLLADAFW::MeshVertexData& normals = mesh->getNormals();
    const COLLADAFW::MeshVertexData& colors = mesh->getColors();
    const COLLADAFW::MeshVertexData& uvCoords = mesh->getUVCoords();
    const COLLADAFW::MeshPrimitiveArray& primitives = mesh->getMeshPrimitives();

    for (int i = 0; i < primitives.getCount(); ++i) {
        const COLLADAFW::MeshPrimitive& primitive = *primitives[i];
        cout << "Primitive " << primitive.getPrimitiveType() << endl;
    }

    return true;
}

bool ColladaWriter::writeMaterial( const COLLADAFW::Material* material )
{
    return true;
}

bool ColladaWriter::writeEffect( const COLLADAFW::Effect* effect )
{
    return true;
}

bool ColladaWriter::writeCamera( const COLLADAFW::Camera* camera )
{
    return true;
}

bool ColladaWriter::writeImage( const COLLADAFW::Image* image )
{
    return true;
}

bool ColladaWriter::writeLight( const COLLADAFW::Light* light )
{
    return true;
}

bool ColladaWriter::writeAnimation( const COLLADAFW::Animation* animation )
{
    return true;
}

bool ColladaWriter::writeAnimationList( const COLLADAFW::AnimationList* animationList )
{
    return true;
}

bool ColladaWriter::writeSkinControllerData( const COLLADAFW::SkinControllerData* skinControllerData )
{
    return true;
}

bool ColladaWriter::writeController( const COLLADAFW::Controller* controller )
{
    return true;
}

bool ColladaWriter::writeFormulas( const COLLADAFW::Formulas* formulas )
{
    return true;
}

bool ColladaWriter::writeKinematicsScene( const COLLADAFW::KinematicsScene* kinematicsScene )
{
    return true;
}

